package com.lgl.scs.base.controller;

import com.lgl.scsapi.base.controller.ApiBaseController;
import com.lgl.scsapi.system.model.AppUser;
import com.lgl.scsapi.util.utils.Constants;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

/**
 * scs子模块的基类Controller
 */
public class BaseController extends ApiBaseController {

	/**
	 * 获取session中的APP用户
	 * @return 当前登录的用户
	 */
	public AppUser getSessionAppUser() {
		Subject currentUser = SecurityUtils.getSubject();  
		Object object = currentUser.getSession().getAttribute(Constants.SESSION_USER);
		if (object != null) {
			return (AppUser) object;
		}
		return null;
	}
}